/**
 * 
 */
package com.estock.common.model.security.enums;

import org.apache.commons.lang.StringUtils;

/**
 * @author richard
 *
 */
public enum StockGroup {
	
	LARGE_CAP(1, "大盘股"), SMALL_CAP(1, "小盘股");
	
	private int groupId;
	private String desc;
	
	StockGroup(int groupId, String desc) {
		this.groupId = groupId;
		this.desc = desc;
	}

	public int getGroupId() {
		return groupId;
	}

	public void setGroupId(int groupId) {
		this.groupId = groupId;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
	
	public static int getGroupIdByDesc(String desc) {
		if (StringUtils.equals(desc, StockGroup.LARGE_CAP.getDesc())) {
			return StockGroup.LARGE_CAP.getGroupId();
		}
		return StockGroup.SMALL_CAP.getGroupId();
	}
	
	public static String getDescByGroupId(int groupId) {
		if (StockGroup.LARGE_CAP.getGroupId() == groupId) {
			return StockGroup.LARGE_CAP.getDesc();
		}
		return StockGroup.SMALL_CAP.getDesc();
	}

}
